function MenuReducer(state = {
    menus: [
        { title: "首页", path: "/home/", status: true }
    ]
}, action) {
    switch (action.type) {
        case "MENUPUSH":
            state.menus.forEach(item => item.status = false)
            state.menus.push(action.payload)
            return { ...state }
        case "UPDATESTATUS":
            obj = { path: "/home/user" }
            const obj = action.payload
            state.menus.forEach(item => {
                if (item.path == obj.path) {
                    item.status = true
                } else {
                    item.status = false
                }
            })
            return { ...state }
        // const obj = action.payload
        // const index = state.menus.findIndex(item=>item.path==obj.path)
        // state.menus[index].status = 1
        // return {...state}
        default:
            return state

    }
}
export default MenuReducer